﻿using System.Text.RegularExpressions;

namespace WishlistUtilities {
    public static class SlugUtility {
        public const char SLUGREPLACEMENTCHAR = '-';

        /// <summary>
        /// Returns a slug for the specified name input string.  All non-alphanumeric (word) characters are convereted to a dash.
        /// </summary>
        /// <param name="name"></param>
        /// <returns>Slug for input string</returns>
        public static string CreateSlug(string name) {
            //Replaces a non-word character with the replacement string
            return Regex.Replace(name, @"[^\w]", SLUGREPLACEMENTCHAR.ToString());
        }
    }
}